import numpy as np
import cv2 as cv
import os
import sys
sys.path.append(os.getcwd())
from config.env import Env
env = Env()

img = cv.imread(env.getImgPath() + "roi.jpg")
green = np.uint8([[[0, 255, 0]]])
hsv_green = cv.cvtColor(green, cv.COLOR_BGR2HSV)
h = hsv_green[0][0][0]
hLow = h - 10
hHigh = h + 10

ball = img[230:280, 270:325]

hsv = cv.cvtColor(ball, cv.COLOR_BGR2HSV)
lowGreen = np.array([40, 100, 100])
upGreen = np.array([60, 255, 255])
mask = cv.inRange(hsv, lowGreen, upGreen)
ball2 = cv.bitwise_not(ball, ball, mask=mask)


img[60:110, 165:220] = ball2

# flags = [i for i in dir(cv) if i. startswith('COLOR_')]
# print(flags)

cv.imshow("img", img)
cv.waitKey(0)
cv.destroyAllWindows()